import request from '@/utils/request'

// 文章相关接口
export const articleApi = {
  getArticleList: (params) => {
    return request({
      url: '/api/Blog/List',
      method: 'get',
      params
    })
  },
  getArticleById: (id) => {
    return request({
      url: `/api/Blog/${id}`,
      method: 'get'
    })
  },
  createArticle: (data) => {
    return request({
      url: '/api/Blog/Create',
      method: 'post',
      data
    })
  },
  updateArticle: (id, data) => {
    return request({
      url: `/api/Blog/Update/${id}`,
      method: 'put',
      data
    })
  },
  deleteArticle: (id) => {
    return request({
      url: `/api/Blog/Delete/${id}`,
      method: 'delete'
    })
  }
}

// 分类相关接口
export const categoryApi = {
  getCategoryList: (params) => {
    return request({
      url: '/api/Category/List',
      method: 'get',
      params
    })
  },
  createCategory: (data) => {
    return request({
      url: '/api/Category/Create',
      method: 'post',
      data
    })
  },
  updateCategory: (id, data) => {
    return request({
      url: `/api/Category/Update/${id}`,
      method: 'put',
      data
    })
  },
  deleteCategory: (id) => {
    return request({
      url: `/api/Category/Delete/${id}`,
      method: 'delete'
    })
  }
}

// 标签相关接口
export const tagApi = {
  getTagList: (params) => {
    return request({
      url: '/api/Tag/List',
      method: 'get',
      params
    })
  },
  createTag: (data) => {
    return request({
      url: '/api/Tag/Create',
      method: 'post',
      data
    })
  },
  updateTag: (id, data) => {
    return request({
      url: `/api/Tag/Update/${id}`,
      method: 'put',
      data
    })
  },
  deleteTag: (id) => {
    return request({
      url: `/api/Tag/Delete/${id}`,
      method: 'delete'
    })
  }
}
